import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '@/components/HomeView.vue'
import NotFound from '@/components/NotFound.vue'
import Dashboard from '@/views/product/Dashboard.vue'
import ExamOnline from '@/views/examOnline/ExamOnline.vue'
import MyQuestionBank from '@/views/examOnline/MyQuestionBank.vue'
import MyGrade from '@/views/examOnline/MyGrade.vue'
import ExamManage from '@/views/examControl/ExamManage.vue'
import MarkManage from '@/views/examControl/MarkManage.vue'
import QuestionBankMange from '@/views/examControl/QuestionBankMange.vue'
import QuestionManage from '@/views/examControl/QuestionManage.vue'
import MarkExam from '@/views/examControl/MarkExam.vue'
import AddExam from '@/views/examControl/AddExam.vue'
import UpdateExam from '@/views/examControl/UpdateExam.vue'
import StaticOverview from '@/views/total/StaticOverview.vue'
import NoticeManage from '@/views/system/NoticeManage.vue'
import RoleManage from '@/views/system/RoleManage.vue'
import UserManage from '@/views/system/UserManage.vue'
import Login from '@/components/Login.vue'
import Exam from '@/views/examOnline/Exam.vue'
import Result from '@/views/examOnline/Result.vue'
import Train from '@/views/examOnline/Train.vue'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      component: Login,
    },
    {
      path: '/login',
      component: Login,
    },
    {
      path: '/exam/:id',
      component: Exam,
    },

    {
      path: '/home',
      component: HomeView,
      children: [
        {
          path: 'dashboard',
          component: Dashboard,
          meta: { title: '产品介绍' },
        },
        {
          path: 'examOnline',
          component: ExamOnline,
          meta: { title: '在线考试 / 在线考试' },
        },
        {
          path: 'myQuestionBank',
          component: MyQuestionBank,
          meta: { title: '在线考试  / 我的题库' },
        },
        {
          path: 'myGrade',
          component: MyGrade,
          meta: { title: '在线考试 / 我的成绩' },
        },
        {
          path: 'examManage',
          component: ExamManage,
          meta: { title: '考试管理 / 考试管理' },
        },
        {
          path: 'questionBankMange',
          component: QuestionBankMange,
          meta: { title: '考试管理 / 题库管理' },
        },
        {
          path: 'questionManage',
          component: QuestionManage,
          meta: { title: '考试管理 / 试题管理' },
        },
        {
          path: 'markManage',
          component: MarkManage,
          meta: { title: '考试管理 / 阅卷管理' },
        },
        {
          path: 'markExam/:recordId',
          component: MarkExam,
          meta: { title: '考试管理 / 批阅试卷' },
        },
        {
          path: 'addExam/',
          component: AddExam,
          meta: { title: '考试管理 / 添加考试' },
        },
        {
          path: 'updateExam/:examId',
          component: UpdateExam,
          meta: { title: '考试管理 / 更新考试' },
        },
        {
          path: 'staticOverview',
          component: StaticOverview,
          meta: { title: '考试管理 / 统计总览' },
        },
        {
          path: 'noticeManage',
          component: NoticeManage,
          meta: { title: ' 系统设置 / 用户管理' },
        },
        {
          path: 'roleManage',
          component: RoleManage,
          meta: { title: '系统设置 / 角色管理' },
        },
        {
          path: 'userManage',
          component: UserManage,
          meta: { title: ' 系统设置 / 用户管理' },
        },
        {
          path: 'result/:id',
          component: Result,
        },
        // 在 src/router/index.js 文件中添加以下路由配置
        {
          path: '/train/:bankId/:additionalParameter',
          name: 'Train',
          component: () => import('@/views/examOnline/Train.vue'),
        },
      ],
    },
    { path: '/:pathMatch(.*)*', name: 'not-found', component: NotFound },
  ],
})

export default router
